package cn.com.miao.lynx.service.system.entity;

import cn.com.miao.lynx.common.base.model.BaseModel;
import lombok.*;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Where;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;

/**
 * SysRolePermission
 *
 * @title: SysRolePermission
 * @description:
 * @author: dengmiao
 * @create: 2020-01-06 15:03
 **/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
@Entity
@Table(name = SysRolePermission.TABLE_NAME)
@SQLDelete(sql = SysRolePermission.LOGIC_DELETE_STATEMENT)
@Where(clause = "del_status = " + SysRolePermission.DELETE_FLAG_NORMAL)
public class SysRolePermission extends BaseModel<Long> {

    public static final String TABLE_NAME = "sys_role_permission";

    public final static String LOGIC_DELETE_STATEMENT = "update " + TABLE_NAME + " set del_status = " + SysDict.DELETE_FLAG_DELETE + " where id = ?";

    /**
     * 角色id
     */
    @Column(columnDefinition = "bigint(20) DEFAULT NULL COMMENT '角色id'")
    private Long roleId;

    /**
     * 权限id
     */
    @Column(columnDefinition = "bigint(20) DEFAULT NULL COMMENT '权限id'")
    private Long permissionId;
}
